<%@ include file="/WEB-INF/jsp/includes/include.jsp" %>
<!-- BEGIN MESSAGE BOARD -->
<h2 id="messageBoardTitle" class="sectionHeader">Messageboard:</h2>

<div id="messageboard">

	<!-- BEGIN MESSAGES -->
	<div id="messages">
		
		<c:forEach items="${entity.messageBoard.messages}" var="message">

		<!-- BEGIN MESSAGE -->
		<div class="msgDetails">
		
			<!-- BEGIN POSTER INFO, DATE-TIME -->
			<div class="posterAndDate">
				<c:url scope="page" value="/user/profile.html" var="userProfileURL">
					<c:param name="id" value="${message.poster.id}"/>
				</c:url>
				Posted by
				<a href="${userProfileURL}">
					<span class="postedBy">${message.poster.name}</span>
				</a>
				<span class="postedOn">
					on 
					<joda:format value="${message.dateCreated.date}" style="S-" /> at 
					<joda:format value="${message.dateCreated.date}" style="-M" />
				</span>
			</div><!-- .posterAndDate -->
			<!-- END POSTER INFO, DATE-TIME -->

			<!-- BEGIN POSTER IMAGE -->
			<div class="msgPosterImg">
				<c:url scope="page" value="/getImage.do" var="imgsrc">
					<c:param name="imgsrc" value="${message.poster.imgSrc}"/>
				</c:url>
				<img src="${imgsrc}" width="60" alt="${message.poster.name}" class="msgPosterImg"/>
			</div><!-- msgPosterImg -->
			<!-- END POSTER IMAGE -->

			<!-- BEGIN POSTED MESSAGE -->
			<div class="msg">
				${message.text}
			</div><!-- .msg -->
			<!-- END POSTED MESSAGE -->
			<hr/>
		</div><!-- .msgDetails -->
		<!-- END MESSAGE -->

		</c:forEach>
	</div> <!-- #messages -->

	<div id="postmessage">

		<form action="<c:url value='/messageboard/postmessage.html'/>" method="post">
			<input type="hidden" name="recipientId" value="${entity.id}" />
			<label for="message.text">
				Message
			</label>
			<textarea name="message.text" cols="65" rows="5"></textarea>
			<input type="submit" value="Post Message">
		</form>
	</div> <!-- #postmessage -->

</div><!-- #messageboard -->		
